package com.lee.boot.head.first.demo.redis.message;


import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.stereotype.Component;

/**
 * @description  redis实现的消息发布和消费
 * @author edz
 */
@Component
public class RedisMessageListener implements MessageListener {


    @Override
    public void onMessage(Message message, byte[] pattern) {
        System.out.println(new String(message.getBody()));
        System.out.println("channel::"+ new String(message.getChannel()));
        System.out.println(new String(pattern));
    }
}
